//波次单
$(function(){
	//搜索
	$('.searchBar').click(function(){
		var thisform=$(this).parent('form');
		var mail_no=thisform.find('input[name=mail_no]').val();
		var listing_no=thisform.find('input[name=listing_no]').val();
		var order_no=thisform.find('input[name=order_no]').val();
		$('#pushorderDatagrid').datagrid('options').pageNumber=1;//设置页码初始值为1
		$('#pushorderDatagrid').datagrid({
			queryParams:{
				mail_no:mail_no,
				listing_no:listing_no,
				order_no:order_no
			}
		});
	})
	$('#pushorderDatagrid').datagrid({
		//url:getOrderUrl+"?randnum="+Math.floor(Math.random()*1000000),
		url:getNuclearOrderUrl,
		title:'核放单',
		fitColumns:true,
		rownumbers:true,
		pageSize:32,
		pageNumber:1,
		pageList:[5,10,15,20,25,30,32,40,50],
		columns:[[
		{field:'id',title:'id',checkbox:true},
		{field:'listing_no',title:'清单编号',sortable:true},
		{field:'order_no',title:'订单编号',sortable:true},
		{field:'mail_no',title:'运单号',sortable:true},
		{field:'declare_time',title:'申报时间',sortable:true},
		{field:'release_time',title:'放行时间',sortable:true},
		{field:'add_time',title:'导入时间',sortable:true}
		]],
		loadMsg:'正在加载订单，请稍等...',
		onLoadError:function(data){
			var info=eval('('+data.responseText+')');
			$.messager.confirm('错误提示',info.message,function(r){
				var tab=$('#Tabs').tabs('getSelected');
				var index=$('#Tabs').tabs('getTabIndex',tab);
				$('#Tabs').tabs('close',index);
			});
		},
		loadFilter: function(data){
			// console.log(data.status);
			if(data.status==0){
				$.messager.alert('错误提示',data.message,'error');
				return false;
			}else{
				return data;
			}
		},
		rowStyler:function(index,row){
			if (row.color==0){
				return 'background-color:pink;color:blue;font-weight:bold;';
			}
			if (row.arrow_status==1){
				return 'background-color:#fff3f3;color:#3F51B5;font-weight:bold;';
			}
			if (row.arrow_status==-1){
				return 'background-color:#009688;color:#fff;font-weight:bold;';
			}
		},
		pagination:true,
		fit:true,
	});
});
pushorderObj={
	excelBar:function(){//确定生成波次单
		var index=layer.open({
			type: 2,
			title: '导入模板',
			shadeClose: true,
			shade: 0.5,
			offset:['180px'],
			area: ['1020px', '135px'],
			content: excelUrl
		});
	},
	showAll:function(){
		$('#pushorderDatagrid').datagrid({ queryParams:''});
	}
}